using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Phoenix.Xna.Framework.Graphics.Lights
{
    public class PointLight : IPointLight
    {
        private List<EffectParameter> _positionParameters;
        private List<EffectParameter> _colorParameters;

        public Vector3 Position
        {
            get { return _positionParameters[0].GetValueVector3(); }
            set
            {
                foreach (EffectParameter p in _positionParameters)
                {
                    p.SetValue(value);
                }
            }
        }
        public Vector3 Color
        {
            get { return _colorParameters[0].GetValueVector3(); }
            set
            {
                foreach (EffectParameter p in _colorParameters)
                {
                    p.SetValue(value);
                }
            }
        }

        internal PointLight(EffectParameter lightStuctParameter)
        {
            _positionParameters = new List<EffectParameter>();
            _colorParameters = new List<EffectParameter>();
        }

        public void RegisterParameters(EffectParameter position, EffectParameter color)
        {
            _positionParameters.Add(position);
            _colorParameters.Add(color);
        }

        public void UnregisterParameters(EffectParameter position, EffectParameter color)
        {
            _positionParameters.Remove(position);
            _colorParameters.Remove(color);
        }
    }
}